<%--
    Document   : index
    Created on : Oct 8, 2014, 10:20:09 PM
    Author     : DucND
--%>

<%@page import="util.Emailer"%>
<%@page import="dao.ManagerDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%! String email;
    String sendBtn;
    String msg;
%>
<%
    msg = "";
    sendBtn = request.getParameter("sendBtn");
    if (sendBtn != null) {
        email = request.getParameter("email");
        if (!ManagerDAO.isExist("Email", email)) {
            msg = "Email does not exist!";
        } else {
            msg = Emailer.SendEmail(email);
        }
    }
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>Forgot Password</title>

        <!-- Bootstrap core CSS -->
        <link type="text/css" href="../css/bootstrap.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="../css/login.css" rel="stylesheet">
    </head>

    <body>

        <div class="container" align="center">

            <form action="forgotPassword.jsp" method="POST">
                <h2 id="h2" class="form-login-heading">Contract Management System</h2>
                <br>
                <Strong>You forgot your password? </Strong> <br><br>
                <p>Don't worry. The new password will be sent to the entered email address.<br>
                The email address must be registered at CMS.</p><br>
                <input type="email" name="email" class="form-control" placeholder="Email address" style="width: 400px" autofocus required>
                <br>
                <button name="sendBtn" class="btn btn-lg btn-primary btn-block" type="submit" style="width: 200px">Send password</button>
                <br><font color="green"><%=msg%></font>
                <br><a href="login.jsp"><u>Click here to return to login page</u></a>
            </form>
        </div> <!-- /container -->
    </body>
</html>